var eleInViewPort = function (el)
{
var rect = el.getBoundingClientRect();
return (rect.top >= 0 && rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth);
}
function loadimg()
{
    $.each($('img.postthumb[datasrc]:not(.scrolled_off)'), function (index,img)
    {
        var $img = $(img);
        if (eleInViewPort(img)) 
        {
            $img.addClass('scrolled_off');
            var src = $img.attr('datasrc');
            $img.removeAttr('datasrc');
            $img.attr('src', src);
        }
    });
}
$(window).bind('scroll',loadimg).scroll();